/*
 * NetworkContext.h
 *
 *  Created on: Jul 13, 2008
 *      Author: Kyle
 */

#ifndef NETWORKCONTEXT_H_
#define NETWORKCONTEXT_H_

#include "includes.h"

/**
 * Holds handle to libpcap adapter
 * Reads raw packets and defers to registered filters
 * Currently only supports tcipip payloads
 */

class AdapterListener;

class NetworkManager {
public:
	NetworkManager();
	virtual ~NetworkManager();
	void operator()();
	static pcap_t *getAdapter(int id);

	static void init();
	static AdapterListener* activate(int id);
	static AdapterListener* activate(int id, bool isPromiscuous);
protected:
	static bool isInitialized;
	static __gnu_cxx::hash_map<int, pcap_t*>* adapter_table;
	static __gnu_cxx::hash_map<int, AdapterListener*>* active_listeners;


};

#endif /* NetworkManager_H_ */
